$(document).ready(function() {

    /*未登录跳转至登录页面*/
    $.ajax({
        url: interfaceGetState,
        type: 'post',
        success: function (data) {
            if (data.status != 0) {
                if(window.sessionStorage){
                    sessionStorage.setItem("prePage","/f/campusinfo/MyApply"+generateMixed(9));
                }
                window.location.href="/f/campusinfo/login"+generateMixed(9);
            } else {
                /*加载我的报名记录*/
                $.ajax({
                    url: "/api/schoolSource/enlist/jobList",
                    type: "post",
                    // data: {},
                    error: function () {
                        $("#Loading").hide();//隐藏“加载中”提示
                        $("#loadingError").show();
                    },
                    success: function (data) {
                        // console.log(data);
                        // console.log(data.campusinfoAbroads);
                        $("#Loading").hide();//隐藏“加载中”提示
                        var count = data.creatJobProjects.length;       //自带项目报名
                        var stujobcount = data.stuJobSearches.length;       //勤工报名
                        var jobmessage = data.jobMesSearches.length;        //就业报名
                        var partcount = data.CreatPartProjects.length;      //园区项目报名
                        var abroadscount = data.campusinfoAbroads.length;     //出国报名                                             //升学与公考--出国报名
                        var  campusinfoPubmeds = data.campusinfoPubmeds.length;//升学与公考--考研报名
                        var  campusinfoServants = data.campusinfoServants.length;  //                                                 //升学与公考--公务员报名
                        var  campusinfoTrains = data.campusinfoTrains.length;   //考证                                                  //证照培训报名
                        var  campusinfoExams = data.campusinfoExams.length;         //考试报名                                           //模拟考试报名
                        var total=count+stujobcount+jobmessage+partcount+abroadscount+campusinfoPubmeds+campusinfoServants+campusinfoTrains+campusinfoExams;
                        if(total==0){
                            $("#empty").show(); //空空如也
                        }else {
                            /*自带项目报名*/
                            for(var i=0;i<count;i++){
                                var applyBorder,applyImg;
                                if(data.creatJobProjects[i].enrollStatus==0){   //未审核
                                    applyBorder="apply-check-aside";
                                    applyImg="apply-checking";
                                }else if(data.creatJobProjects[i].enrollStatus==1){ //审核完成
                                    applyBorder="apply-pass-aside";
                                    applyImg="apply-pass";
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"创业-自带项目"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"项目名称"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.creatJobProjects[i].projectName+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"项目内容"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.creatJobProjects[i].projectContent+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"合作伙伴"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.creatJobProjects[i].partner+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-fund'>"+"个人自有资金"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.creatJobProjects[i].individualownfunds+"万元"+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-loans'>"+"个人需要贷款"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.creatJobProjects[i].personalneedloan+"万元"+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.creatJobProjects[i].createDate+"</label></div> " + "</div>");
                            }
                            /*勤工报名*/
                            for(var i=0;i<stujobcount;i++){
                                var applyBorder,applyImg;
                                if(data.stuJobSearches[i].enrollStatus==0){   //未审核
                                    applyBorder="apply-check-aside";
                                    applyImg="apply-checking";
                                }else if(data.stuJobSearches[i].enrollStatus==1){ //审核完成
                                    applyBorder="apply-pass-aside";
                                    applyImg="apply-pass";
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"勤工俭学"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"勤工内容"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.stuJobSearches[i].reqContent+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"工资范围"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.stuJobSearches[i].reqPay+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"提供福利说明"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.stuJobSearches[i].reqStatement+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.stuJobSearches[i].createDate+"</label></div> " + "</div>");
                            }
                            /*园区项目报名*/
                            for(var i=0;i<partcount;i++){
                                var applyBorder,applyImg;
                                if(data.CreatPartProjects[i].enrollStatus==0){   //未审核
                                    applyBorder="apply-check-aside";
                                    applyImg="apply-checking";
                                }else if(data.CreatPartProjects[i].enrollStatus==1){ //审核完成
                                    applyBorder="apply-pass-aside";
                                    applyImg="apply-pass";
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"创业-园区项目"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"项目名称"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.CreatPartProjects[i].partName+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"项目内容"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.CreatPartProjects[i].partContent+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"合作伙伴"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.CreatPartProjects[i].partner+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-fund'>"+"个人自有资金"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.CreatPartProjects[i].individualownfunds+"万元"+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-loans'>"+"个人需要贷款"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.CreatPartProjects[i].personalneedloan+"万元"+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.CreatPartProjects[i].createDate+"</label></div> " + "</div>");
                            }
                            /*就业报名*/
                            for(var i=0;i<jobmessage;i++){
                                var applyBorder,applyImg;
                                if(data.jobMesSearches[i].enrollStatus==0){   //未审核
                                    applyBorder="apply-check-aside";
                                    applyImg="apply-checking";
                                }else if(data.jobMesSearches[i].enrollStatus==1){ //审核完成
                                    applyBorder="apply-pass-aside";
                                    applyImg="apply-pass";
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"就业报名"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"岗位内容"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.jobMesSearches[i].jobcontent+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"工资范围"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.jobMesSearches[i].jobpay+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"提供福利说明"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.jobMesSearches[i].jobstatement+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.jobMesSearches[i].createDate+"</label></div> " + "</div>");
                            }
                            /*出国留学*/
                            for(var i=0;i<abroadscount;i++){
                                var applyBorder,applyImg;
                                if(data.campusinfoAbroads[i].status==0){   //未支付
                                    applyBorder="apply-check-aside";
                                    applyImg="unpaid";
                                }else if(data.campusinfoAbroads[i].status==1){ //已支付
                                    applyBorder="apply-pass-aside";
                                    applyImg="already-paid";
                                }
                                var paymentMethod;
                                //console.log(data.campusinfoAbroads[i].paymentMethod);
                                if(data.campusinfoAbroads[i].paymentMethod!='3'){
                                    paymentMethod='线下缴费';
                                }else{
                                    paymentMethod='线上缴费';
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"出国留学"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"报考地区"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoAbroads[i].region+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考国家"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoAbroads[i].country+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"培训费用(元)"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoAbroads[i].payment+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"缴费方式"+"</div></div> " +
                                    "<div class='apply-content-right'>"+ paymentMethod+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"订单编号"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoAbroads[i].orderCode+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.campusinfoAbroads[i].createDate+"</label></div> " + "</div>");
                            }
                            /*考研*/
                            for(var i=0;i<campusinfoPubmeds;i++){
                                var applyBorder,applyImg;
                                if(data.campusinfoPubmeds[i].status==0){   //未支付
                                    applyBorder="apply-check-aside";
                                    applyImg="unpaid";
                                }else if(data.campusinfoPubmeds[i].status==1){ //已支付
                                    applyBorder="apply-pass-aside";
                                    applyImg="already-paid";
                                }
                                var paymentMethod;
                                //console.log(data.campusinfoAbroads[i].paymentMethod);
                                if(data.campusinfoPubmeds[i].paymentMethod!='3'){
                                    paymentMethod='线上缴费';
                                }else{
                                    paymentMethod='线下缴费';
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"考研报名"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-name'>"+"报考学校"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoPubmeds[i].schoolname+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考学院"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoPubmeds[i].collegename+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考专业"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoPubmeds[i].majorname+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"培训费用(元)"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoPubmeds[i].payment+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"缴费方式"+"</div></div> " +
                                    "<div class='apply-content-right'>"+paymentMethod+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"订单编号"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoPubmeds[i].orderCode+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.campusinfoPubmeds[i].createDate+"</label></div> " + "</div>");
                            }
                            /*公务员考试*/
                            for(var i=0;i<campusinfoServants;i++){
                                var applyBorder,applyImg;
                                if(data.campusinfoServants[i].status==0){   //未支付
                                    applyBorder="apply-check-aside";
                                    applyImg="unpaid";
                                }else if(data.campusinfoServants[i].status==1){ //已支付
                                    applyBorder="apply-pass-aside";
                                    applyImg="already-paid";
                                }
                                var paymentMethod;
                                //console.log(data.campusinfoAbroads[i].paymentMethod);
                                if(data.campusinfoServants[i].paymentMethod!='3'){
                                    paymentMethod='线上缴费';
                                }else{
                                    paymentMethod='线下缴费';
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"公务员报名"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考名称"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoServants[i].servantName+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"培训费用(元)"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoServants[i].payment+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"缴费方式"+"</div></div> " +
                                    "<div class='apply-content-right'>"+paymentMethod+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"订单编号"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoServants[i].orderCode+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.campusinfoServants[i].createDate+"</label></div> " + "</div>");
                            }
                            /*考证*/
                            for(var i=0;i<campusinfoTrains;i++){
                                var applyBorder,applyImg;
                                if(data.campusinfoTrains[i].status==0){   //未支付
                                    applyBorder="apply-check-aside";
                                     applyImg="unpaid";
                                }else if(data.campusinfoTrains[i].status==1){ //已支付
                                    applyBorder="apply-pass-aside";
                                    applyImg="already-paid";
                                }
                                var paymentMethod;
                                //console.log(data.campusinfoAbroads[i].paymentMethod);
                                if(data.campusinfoTrains[i].paymentMethod!='3'){
                                    paymentMethod='线上缴费';
                                }else{
                                    paymentMethod='线下缴费';
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"考证"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考名称"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoTrains[i].trainName+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"培训费用(元)"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoTrains[i].payment+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"缴费方式"+"</div></div> " +
                                    "<div class='apply-content-right'>"+paymentMethod+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"订单编号"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoTrains[i].orderCode+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.campusinfoTrains[i].createDate+"</label></div> " + "</div>");
                            }
                            /*模拟考*/
                            for(var i=0;i<campusinfoExams;i++){
                                var applyBorder,applyImg;
                                if(data.campusinfoExams[i].status==0){   //未支付
                                    applyBorder="apply-check-aside";
                                    applyImg="unpaid";
                                }else if(data.campusinfoExams[i].status==1){ //已支付
                                    applyBorder="apply-pass-aside";
                                    applyImg="already-paid";
                                }
                                var paymentMethod;
                                //console.log(data.campusinfoAbroads[i].paymentMethod);
                                if(data.campusinfoExams[i].paymentMethod!='3'){
                                    paymentMethod='线上缴费';
                                }else{
                                    paymentMethod='线下缴费';
                                }
                                $("#compus-msg-content").append("<div class='apply startup "+applyImg+"'> "+"<div class='apply-aside "+applyBorder+"'>"+"</div>"+"<div class='apply-title'>"+"模拟考试"+"</div>" +"<div class='apply-content'> " +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"报考名称"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoExams[i].examName+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-partner'>"+"培训费用(元)"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoExams[i].payment+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"缴费方式"+"</div></div> " +
                                    "<div class='apply-content-right'>"+paymentMethod+"</div>" +
                                    "<div class='apply-content-left'><div class='startup-content'>"+"订单编号"+"</div></div> " +
                                    "<div class='apply-content-right'>"+data.campusinfoExams[i].orderCode+"</div>" +
                                    "</div>"+"<div class='apply-time'>"+"报名时间:"+"<label style='display: inline'>"+data.campusinfoExams[i].createDate+"</label></div> " + "</div>");
                            }
                        }
                    }
                });
            }
        }
    });
});